package com.yeban.javase.day12.demo;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Desc TODO
 * @Author yeban
 * @Date 2025/10/22
 */
public class EmployeeName {

    public static void main(String[] args) {
        List<Employee> employees = new ArrayList<>();
        employees.add(new Employee("张三", 10000));
        employees.add(new Employee("李四", 10000));
        employees.add(new Employee("张菲", 10000));
        employees.add(new Employee("王五", 10000));
        employees.add(new Employee("张伟", 10000));

        employees.stream().map(Employee::getName).filter(p -> p.startsWith("张")).collect(Collectors.toList());
    }
}

class Employee {
    private String name;
    private int salary;

    public Employee() {
    }

    public Employee(String name) {
        this.name = name;
    }

    public Employee(String name, int salary) {
        this.name = name;
        this.salary = salary;
    }

    /**
     * 获取
     * @return name
     */
    public String getName() {
        return name;
    }

    /**
     * 设置
     * @param name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 获取
     * @return salary
     */
    public int getSalary() {
        return salary;
    }

    /**
     * 设置
     * @param salary
     */
    public void setSalary(int salary) {
        this.salary = salary;
    }

    public String toString() {
        return "Employee{name = " + name + ", salary = " + salary + "}";
    }
}
